class Link < ActiveRecord::Base

  # class UrlValidator < ActiveModel::Validator
  #   require 'uri'
  #   def validate(record)
  #     begin
  #      !!URI.parse(uri)     
  #    rescue URI::InvalidURIError
  #     record.errors[:short] << '输入的网址不正确'
  #   end
  # end

  # include ActiveModel::Validations
  #  validates_with UrlValidator
  validates_format_of :origin, :with => URI::regexp(%w(http https)), :message => "请输入http、https开头的网址"

end
